﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Entities;
using DevExpress.Web.ASPxEditors;
namespace Stationery.UC
{
    public partial class UC_CategoryList_Update : System.Web.UI.UserControl
    {
        BLL_MenuURL bll_MenuURL = new BLL_MenuURL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session[Utils.SESSION_DATA] = bll_MenuURL.Get_MenuURL_Dynamic(String.Format("ISNULL(ID_PARENT,0)<>0 AND TYPE='{0}'",MenuURL.column));
            }
            else
            {
                if (Session[Utils.SESSION_DATA] == null)
                {
                    Session[Utils.SESSION_DATA] = bll_MenuURL.Get_MenuURL_Dynamic(String.Format("ISNULL(ID_PARENT,0)<>0 AND TYPE='{0}'", MenuURL.column));
                }
            }
            ASPxGridView1.DataSource = Session[Utils.SESSION_DATA];
            ASPxGridView1.DataBind();
        }

        protected void ASPxTextBoxName_TextChanged(object sender, EventArgs e)
        {

        }

        protected void ASPxButtonAdd_Click(object sender, EventArgs e)
        {
            Response.Redirect(UtilsURL.category_add);
        }

        protected void LinkButtonDelete_Click(object sender, EventArgs e)
        {
            Int64 intID = Convert.ToInt64(((LinkButton)sender).CommandArgument.ToString());
            bll_MenuURL.DeleteMenuURL(intID);
            Response.Redirect(Request.RawUrl);
        }
    }
}